package com.slz3.business.module.goodsManagement.gooTypeLevel1.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.goodsManagement.gooTypeLevel1.domain.GooTypeLevel1;
import com.slz3.business.module.goodsManagement.gooTypeLevel1.domain.GooTypeLevel1Factory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class GooTypeLevel1TransactionalServiceImpl implements GooTypeLevel1TransactionalService {

    @Override
    public GooTypeLevel1 modify(GooTypeLevel1 gooTypeLevel1New) {
        Repositorys.gooTypeLevel1.test();
        Repositorys.gooTypeLevel1.save(GooTypeLevel1Factory.initBaseFields());
        System.err.println(1/0);
        gooTypeLevel1New.setLastModifyTime(LocalDateTime.now());
        return Repositorys.gooTypeLevel1.saveAndFlush(gooTypeLevel1New);
    }

    @Override
    public List<GooTypeLevel1> batchModify(List<GooTypeLevel1> gooTypeLevel1List) {
        return Repositorys.gooTypeLevel1.saveAll(gooTypeLevel1List);
    }
}
